home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume91 / shells / cshel500 / part05 < prev    next >
Encoding:
Internet Message Format  |  1991-03-03  |  35.3 KB

  1. Path: news.larc.nasa.gov!amiga-request
  2. From: amiga-request@ab20.larc.nasa.gov (Amiga Sources/Binaries Moderator)
  3. Subject: v91i031: CShell 5.00 - alternative command interface, Part05/06
  4. Reply-To: <umueller@iiic.ethz.ch>
  5. Newsgroups: comp.sources.amiga
  6. Message-ID: <comp.sources.amiga:v91i031@ab20.larc.nasa.gov>
  7. References: <comp.sources.amiga:v91i027@ab20.larc.nasa.gov>
  8. Date: 03 Mar 91 21:56:07 GMT
  9. Approved: tadguy@uunet.UU.NET (Tad Guy)
  10. X-Mail-Submissions-To: amiga@uunet.uu.net
  11. X-Post-Discussions-To: comp.sys.amiga.misc
  12.  
  13. Submitted-by: <umueller@iiic.ethz.ch>
  14. Posting-number: Volume 91, Issue 031
  15. Archive-name: shells/cshell-5.00/part05
  16.  
  17. #!/bin/sh
  18. # This is a shell archive.  Remove anything before this line, then unpack
  19. # it by saving it into a file and typing "sh file".  To overwrite existing
  20. # files, type "sh file -c".  You can also feed this as standard input via
  21. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  22. # will see the following message at the end:
  23. #        "End of archive 5 (of 6)."
  24. # Contents:  shell.doc.ab
  25. # Wrapped by tadguy@ab20 on Sun Mar  3 16:56:01 1991
  26. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  27. if test -f 'shell.doc.ab' -a "${1}" != "-c" ; then 
  28.   echo shar: Will not clobber existing file \"'shell.doc.ab'\"
  29. else
  30. echo shar: Extracting \"'shell.doc.ab'\" \(33033 characters\)
  31. sed "s/^X//" >'shell.doc.ab' <<'END_OF_FILE'
  32. X    using any MAKE utility.
  33. X    Example:
  34. X    if -t test.o test.asm test.i ; asm -o test.o test.asm ; endif
  35. X
  36. X    Option -r evaluates a given RPN expression (see under RPN for more
  37. X    info): if value on top of stack is 0, then FALSE, else TRUE.
  38. X
  39. X    Switch -n (NOT) reverses the result.
  40. X
  41. X    To test if a given variable is defined, use if -v varname.
  42. X
  43. X    When using 'IF' command interactively if you are entering commands
  44. X    following an 'IF' that was false, the prompt will be set to a
  45. X    underscore '_ ' to indicate all commands will be ignored until
  46. X    an 'ELSE' or 'ENDIF' command is seen.
  47. X
  48. X    INC
  49. X    Usage    : inc varname [value]
  50. X    Example    : inc abc 5
  51. X
  52. X    Increment the numerical equivalent of the variable with specified
  53. X    value (default: 1) and place the ascii-string result back into
  54. X    that variable.
  55. X
  56. X    INFO
  57. X    Usage    : info [path1 path2 ... pathN]
  58. X
  59. X    If called without arguments, info gives you the drive information
  60. X    on all devices. If one or more paths are specified, only infor-
  61. X    mation on those drives will be displayed.
  62. X
  63. X    INPUT
  64. X    Usage    : input [-s] var var ... var
  65. X    Example    : input abc
  66. X
  67. X    Input from STDIN (or a redirection, or a pipe) to a variable.  The
  68. X    next input line is broken up in words (unless quoted) and placed in
  69. X    the variable. If -s is turned on, the whole line is read in as one
  70. X    word, including spaces. -r puts the console to single character mode
  71. X    before reding.
  72. X
  73. X    JOIN
  74. X    Usage    : join [-r] file1..fileN destfile
  75. X    Example    : join part1 part2 part3 total
  76. X
  77. X    Joins the specified files to get destfile. If destfile already
  78. X    exists, an error message is generated and operation is aborted,
  79. X    unless you specify -r (replace) option.
  80. X
  81. X    KEYMAP
  82. X    Usage    : keymap number {key=function}
  83. X    Example    : keymap 0 1030=4 1032=12
  84. X
  85. X    Defines one keymap for the cshell command line editing. See chapter
  86. X    XV.
  87. X
  88. X    LABEL
  89. X    Usage    : label name
  90. X
  91. X    Create a program label right here. Used in source files, can then
  92. X    GOTO a label.
  93. X
  94. X    LINECNT
  95. X    Another filter. Counts the number of lines of its stdin and writes
  96. X    it to stdout.
  97. X
  98. X    LS
  99. X    Equivalent to dir.
  100. X
  101. X    MD
  102. X    Equivalent to mkdir.
  103. X
  104. X    MAN
  105. X    Usage    : man command(s)
  106. X    Example    : man mkdir
  107. X
  108. X    Get  info about a Shell command, or others keywords.  These include
  109. X    all  special  _variables, plus various keywords:  WILDCARDS, PIPES,
  110. X    EDITING, and more.
  111. X    See special alias manlist to get a list of ALL keywords supported
  112. X    by man.
  113. X    You  must set _man to the path of your .doc files:
  114. X       set _man dh1:docs/shell.doc
  115. X
  116. X    MEM
  117. X    Usage    : mem [-cfqu]
  118. X
  119. X    Options:
  120. X      -c shows the free chip mem only
  121. X      -f shows the free fast mem only
  122. X      -q outputs just a number without titles
  123. X      -s stores current free memory
  124. X      -r shows memory used relative to last stored 
  125. X
  126. X    MENU
  127. X    Usage    : menu [-n] [ title item...item ]
  128. X    Example    : menu Shell   JrComm,,j   Rename,"rename ",r  quit
  129. X
  130. X    Appends one pull down in the current console window. Up to six
  131. X    menus with 16 items every can be installed.
  132. X
  133. X    If the item is just a string, that string will be in the menu item.
  134. X    When you select it, it will be put into the prompt and executed.
  135. X
  136. X    If there is a comma and after that comma a second string, this
  137. X    will be the command will be inserted at the prompt. This time you
  138. X    have to add the ^M yourself if you want the command to be executed.
  139. X
  140. X    If there is a second comma, the letter after that comma will be
  141. X    the keyboard shortcut for that menu item. (This will be case 
  142. X    sensitive some day, use lowercase).
  143. X
  144. X    If for any reason your current menu is corrupt, just enter an
  145. X    empty 'menu' command.
  146. X
  147. X    To clear all existing menus use option -n.
  148. X
  149. X    MKDIR (MD)
  150. X    Usage    : mkdir name name name...
  151. X    Example    : mkdir df0:stuff
  152. X
  153. X    Create the specified directories.
  154. X
  155. X    MV
  156. X    Equivalent to rename.
  157. X
  158. X    OPEN
  159. X    Usage    : open filename filemode filenumber
  160. X    Example    : open RAM:data w 1
  161. X
  162. X    This  allows you to open a file, redirect to it as many commands as
  163. X    you like, then close it.
  164. X    Filename is any valid AmigaDOS filename, filemode is either "r" for
  165. X    read or "w" for write, filenumber is a number between 1 and 10.
  166. X    To  redirect  a  program to or from an open file, use as your redir
  167. X    filename a dot followed by the filenumber.
  168. X    Here is a complete example:
  169. X
  170. X        open RAM:data w 1
  171. X        echo -n 2+2= >.1
  172. X        rpn 2 2 + . CR >.1
  173. X        close 1
  174. X        type RAM:data    # will display 2+2=4
  175. X
  176. X    See also close, flist.
  177. X
  178. X    PATH
  179. X    Usage    : path [-r] [dir...dir]
  180. X
  181. X    Without arguments, lists AmigaDOS path. Otherwise adds given directories
  182. X    to the path, preventing duplicate entries.
  183. X    Options:
  184. X     -r Resets the path
  185. X
  186. X    PRI
  187. X    Usage    : pri clinumber pri
  188. X    Example    : pri 3 5    # set priority of cli #3 to 5
  189. X
  190. X    Change the priority of the specified task (use PS command to
  191. X    determine clinumber). If you specify 0 as clinumber you can
  192. X    change priority of "this" task (the one executing shell).
  193. X
  194. X    PROTECT
  195. X    Usage    : protect file1 ... filen [+|-|=][flags]
  196. X    Example    : protect myfile +rwe
  197. X
  198. X    Set AMIGADOS file protection flags for the file specified. Valid
  199. X    flags are h, s, p, a, r, w, e, d. Modes:
  200. X      +  Set specified bits, leave all others
  201. X      -  Clear specified bits, leave all others
  202. X      =  Set specified bits, clear all others
  203. X    Specifying no mode is equal to '='. Archive bit cleared by default.
  204. X
  205. X    PS
  206. X    Usage    : ps [commandname...commandname]
  207. X
  208. X    Gives status of CLI processes.  eg:
  209. X
  210. X    Proc Command Name    CLI Type    Pri.  Address  Directory
  211. X    * 1  csh            Initial CLI   0      97b0  Stuff:shell
  212. X      2  clock            Background  -10    2101a8  Workdisk:
  213. X      3  emacs            Background    0    212f58  Stuff:shell
  214. X      4  VT100            Background    0    227328  Workdisk:
  215. X
  216. X    Address is the address of the task, directory is the process
  217. X    currently CD'd directory. My default, only the BaseNames of
  218. X    the commands are shown. Your own CLI will be marked by an
  219. X    asterisk in the first column.
  220. X    Options:
  221. X     -l shows full pathnames of commands
  222. X     -e excludes the given command names from the list
  223. X
  224. X    PWD
  225. X    Usage    : pwd
  226. X
  227. X    Rebuild _cwd by backtracing from your current directory.
  228. X
  229. X    QSORT
  230. X    Usage   : qsort <in >out
  231. X
  232. X    Quick sorts from stdin to stdout
  233. X
  234. X    QUIT
  235. X    Usage    : quit
  236. X
  237. X    Quit out of Shell back to CLI.
  238. X
  239. X    RBACK
  240. X    Usage    : rback command
  241. X
  242. X    Start a new process executing the specified command, but can't do
  243. X    input/output. Equivalent to 'run command >NIL: <NIL:'.
  244. X    Instead of using rback, you can add a '&' at the end of the command
  245. X    line.
  246. X    Note: rback cannot start builtin commands.
  247. X
  248. X    READFILE
  249. X    Usage    : readfile varname [filename]
  250. X
  251. X    Completely reads a (short!) ascii file and assigns it to a variable.
  252. X    Each line becomes one word in the resulting string. Embedded blanks
  253. X    are no problem, but files longer than 256 lines are. If file name is
  254. X    omitted, stdin is used.
  255. X
  256. X    RENAME (MV)
  257. X    Usage    : rename from to
  258. X    or    : rename from from from ... from todir
  259. X
  260. X    Allows you to rename a file or move it around within a disk.
  261. X    Allows you to move 1 or more files into a single directory.
  262. X    The archive bit of the file(s) will be cleared.
  263. X
  264. X    RESIDENT
  265. X    Usage    : resident [-r][-d] [files]
  266. X    Example    : resident lc1 lc2 blink    # load these as resident
  267. X          resident -d lc1 lc2 blink    # defer load when needed
  268. X          resident -r lc1 lc2 blink    # remove these
  269. X          resident            # list resident programs
  270. X
  271. X    This is ARP resident. Commands are searched by Shell in resident
  272. X    list BEFORE of searching on any external device.
  273. X    Only PURE programs can run as resident, see ARP docs for more info.
  274. X    Option -d is very useful: you can say, in your startup file,
  275. X    resident -d file...file; programs will not be loaded immediately,
  276. X    but only when you will try to load them. This way, you will not
  277. X    waste memory and startup time if you don't use the programs.
  278. X    Old option -a has no more effect.
  279. X
  280. X    RETURN
  281. X    Usage    : return [n]
  282. X    Example    : return 10
  283. X
  284. X    Exit from a script file, or quit from shell with optional
  285. X    exit code.
  286. X
  287. X    RM
  288. X    Equivalent to delete.
  289. X
  290. X    RPN
  291. X    Usage    : rpn expression
  292. X    Example    : rpn 3 7 *    # Prints the value 21
  293. X
  294. X    Evaluate an RPN expression, using 32-bit values. In older versions
  295. X    of Shell RPN contained string functions too, but now that strings
  296. X    are handled by specifical commands, these are no more needed.
  297. X    At end of evaluation, RPN prints values on stack, so you can
  298. X    say for instance "rpn $x 2 * | input x" to double the value of
  299. X    variable x.
  300. X    Functions implemented are:
  301. X
  302. X        + - * /    Obvious meaning; / means integer division, of course
  303. X        %        Module operator e.g. "rpn 7 3 %" answers 1
  304. X        & | ~    Bitwise and, or, not operators
  305. X        > < ==    Tests for greater-than, lower-than, equal. To get
  306. X            a test for >= (or <=), you can use < ! (or > !)
  307. X        !        Logical not operator
  308. X        DUP        Duplicate value on top of stack
  309. X        DROP    Drop value on top of stack
  310. X        SWAP    Swap two values on top of stack
  311. X
  312. X    To avoid confusion with redirections, > and < operators must be
  313. X    enclosed in quotes e.g.
  314. X
  315. X        3 2 ">"        # Prints 1
  316. X
  317. X    RUN
  318. X    Usage    : run prgm args
  319. X    Example    : run emacs test.c
  320. X
  321. X    Start a new process executing the specified command.
  322. X    In current implementation run command can't be redirected.
  323. X    This command is not fully reliable: use at your own risk.
  324. X    See also rback.
  325. X
  326. X    RXREC
  327. X    Usage    : rxrec [portname]
  328. X
  329. X    Create an AREXX-compatible port of the specified name (defaults to
  330. X    "rexx_csh"), then puts Shell to sleep waiting for messages on it.
  331. X
  332. X    CAUTION: the only way to exit from this status is to send to the port
  333. X    the message "bye".
  334. X
  335. X    Example:
  336. X    Open two Shell's in two separate CLI's. From the first, type:
  337. X
  338. X        rxrec
  339. X
  340. X    Now first Shell doesn't respond to keyboard input; instead, it waits
  341. X    for messages on a port called "rexx_csh". Now, from the other, type:
  342. X
  343. X        rxsend rexx_csh "dir df0:"
  344. X
  345. X    You will see the listing of df0: in the first Shell. Experiment as you
  346. X    like, then:
  347. X
  348. X        rxsend rexx_csh bye
  349. X
  350. X    And all will return to normal.
  351. X
  352. X    RXSEND
  353. X    Usage    : rxsend [-lr] portname command...command
  354. X
  355. X    Send commands to any program with an AREXX-compatible port. Be aware
  356. X    that every word is sent as a single command!
  357. X
  358. X    You don't have to load anything to use these command (or rxrec):
  359. X    all you need is a program with the right port.
  360. X
  361. X    An example is CygnusEdProfessional: here is, for instance, a command
  362. X    to wake it up, load the file test.c and jump to line 20:
  363. X
  364. X        rxsend rexx_ced cedtofront "open test.c" "jmp to line 20"
  365. X        # rexx_ced is the name of AREXX port for CygnusEd
  366. X
  367. X    The option -r sets the variable _result to the result string
  368. X    of the AREXX command.
  369. X    The option -l send the whole line as *one* command.
  370. X
  371. X    Refer to your application manual for details and for the names
  372. X    of the commands and the port.
  373. X
  374. X    SEARCH
  375. X    Usage    : search [-abcefnqrvw] file...file string
  376. X
  377. X    Search specified files for a string. Only lines containing the
  378. X    specified strings are displayed.
  379. X
  380. X    If the filename is STDIN (in uppercase), the standard input is
  381. X    used, so you can use search as the destination for a pipe.
  382. X    Example:
  383. X        strings myprog 8 | search STDIN .library
  384. X    Lists all libraries used in "myprog".
  385. X
  386. X    Search is very fast if none of the options -w, -e and STDIN was
  387. X    specified and the file fits into memory.
  388. X
  389. X    Options:
  390. X      -a (abort)   stops search as soon as the pattern was found once
  391. X      -b (binary)  shows only byte offsets instead of lines. If combined
  392. X                   with -n, shows naked numbers. 
  393. X      -c (case)    turns ON case sensitivity
  394. X      -e (exclude) lists lines NOT containing the pattern
  395. X      -f (files)   causes only the names of the files in which the pat-
  396. X                   tern was found to be displayed.
  397. X      -l (left)    pattern must be at beginning of line (this is faster
  398. X                   than using a wild card)
  399. X      -n (number)  turns off line numbering
  400. X      -o (only)    finds only whole words
  401. X      -q (quiet)   suppresses printing of file names.
  402. X      -r (recurse) if you specify any directory, all files in that di-
  403. X                   rectory are recursively searched.
  404. X      -v (verbose) shows each file name on a single line. this is auto-
  405. X                   matically turned on if search is redirected
  406. X      -w (wild)    wild card matching. see notes below
  407. X
  408. X    Notes to wild card matching;
  409. X    - Uses Shell standard matching.
  410. X    - All standard ARP wildcards are allowed * ? [] () | ~ ' #
  411. X    - The WHOLE line must match the string, not only a substring.
  412. X    - String MUST be enclosed in quotes to avoid wildcard expansion
  413. X
  414. X    Examples:
  415. X        search -cr df0:include ACCESS
  416. X    Find all occurrencies of ACCESS (in uppercase) in all files
  417. X    contained in include directory.
  418. X        search -w shell.h "'#define*"
  419. X    Lists only lines of file beginning with (not simply containing)
  420. X    #define. Note the use of ' to escape the special symbol #.
  421. X
  422. X    SET
  423. X    Usage    : set [name] [string]
  424. X    Example    : set abc hello
  425. X
  426. X    Set with no args lists all current variable settings.
  427. X    Set with one arg lists the setting for that particular variable.
  428. X    Specifying name and string, stores the string into variable name.
  429. X
  430. X    Also See the section on special _variables.
  431. X
  432. X    SETENV
  433. X    Usage    : setenv envvar value
  434. X
  435. X    Sets an ENV: variable to the given value. The value must be
  436. X    enclosed in quotes if it contains spaces.
  437. X
  438. X    SLEEP
  439. X    Usage    : sleep timeout
  440. X    Example    : sleep 10
  441. X
  442. X    Sleep for 'timeout' seconds, or until ^C typed.
  443. X
  444. X    SPLIT
  445. X    Usage    : split srcvar dstvar...dstvar
  446. X
  447. X    Assigns one word of srcvar to every dstvar, the rest of srcvar to
  448. X    the last dstvar.
  449. X    Note: You enter variable NAMES, not variables.
  450. X
  451. X    STACK
  452. X    Usage    : stack [number]
  453. X    Example    : stack 8000
  454. X
  455. X    Changes the default stack for this CLI. Without arguments, prints
  456. X    it.
  457. X
  458. X    STRHEAD
  459. X    Usage    : strhead varname breakchar string
  460. X    Example    : strhead x . foobar.bas    # Will set x to "foobar"
  461. X
  462. X    Remove everything after and including the breakchar in 'string' and
  463. X    place in variable 'varname'.
  464. X
  465. X    STRINGS
  466. X    Usage    : strings file1..fileN minlenght
  467. X    Example    : strings c:dir c:list shell 7
  468. X
  469. X    Prints strings contained in specified files (usually binary)
  470. X    with lenght >= minlenght.
  471. X
  472. X    STRLEFT
  473. X    Usage    : strleft varname string n
  474. X    Example    : strleft x LongString 5    # Will set x to "LongS"
  475. X
  476. X    Place leftmost n chars of string in variable varname.
  477. X
  478. X    STRLEN
  479. X    Usage    : strlen varname string
  480. X    Example    : strlen x Hello        # Will set x to "5"
  481. X
  482. X    Puts len of string in variable varname.
  483. X
  484. X    STRMID
  485. X    Usage    : strmid varname string n1 [n2]
  486. X    Example    : strmid x LongString 5 3    # Will set x to "Str"
  487. X
  488. X    Places n2 chars from string, starting at n1, in variable varname.
  489. X    By omitting n2, you get all chars from n1 to end of string.
  490. X
  491. X    STRRIGHT
  492. X    Usage    : strright varname string n
  493. X    Example    : strright x LongString 5    # Will set x to "tring"
  494. X
  495. X    Place rightmost n chars of string in variable varname.
  496. X
  497. X    STRTAIL
  498. X    Usage    : strtail varname breakchar string
  499. X    Example    : strtail x . foobar.bas    # Will set x to "bas"
  500. X
  501. X    Remove everything before and including the breakchar in 'string' and
  502. X    place in variable 'varname'.
  503. X
  504. X    SOURCE
  505. X    Usage    : source file [arguments]
  506. X    Example    : source mymake.sh all
  507. X    Result    : source file 'mymake.sh' called with var _passed = 'all'
  508. X
  509. X    Execute commands from a file.  You can create SHELL programs in
  510. X    a file and then execute them with this command.  Source'd files
  511. X    have the added advantage that you can have loops in your command
  512. X    files (see GOTO and LABEL).  You can pass SOURCE files arguments
  513. X    by specifying arguments after the file name.  Arguments are passed
  514. X    via the _passed variable (as a single string).
  515. X
  516. X    Long lines may be split by appending a backslash (\) at end of
  517. X    first half. However, even joined lines cannot be longer than
  518. X    ~255 chars. See example of source files.
  519. X
  520. X    Automatic 'sourcing' is accomplished by placing a .sh suffix on
  521. X    the file and executing it as you would a C program:
  522. X
  523. X    --------- file hello.sh ---------
  524. X    foreach i ( $_passed ) "echo yo $i"
  525. X    ---------------------------------
  526. X
  527. X    $ hello a b c
  528. X    yo a
  529. X    yo b
  530. X    yo c
  531. X
  532. X    TACKON
  533. X    Usage    : tackon var pathname filename
  534. X    Example    : tackon x df0:c Dir    # sets x to "df0:c/Dir"
  535. X    or    : tackon x df0: Preferences #sets x to "df0:Preferences"
  536. X
  537. X    Correctly  adds  a  filename  to a pathname, and puts the result in
  538. X    variable specified.
  539. X
  540. X    TAIL
  541. X    Usage    : tail filename [num]
  542. X    Example    : tail readme 20
  543. X
  544. X    Display  last  "num" lines of "filename".  If num is not specified,
  545. X    10 is assumed.
  546. X
  547. X    TEE
  548. X    Usage    : tee [file]
  549. X    Example    : cc test.c | tee >error.list
  550. X
  551. X    Copies stdin to stdout and the given file. If file is omitted, sterr
  552. X    is used.
  553. X
  554. X    TOUCH
  555. X    Usage    : touch file1 .. fileN
  556. X
  557. X    Sets DateStamp of the specified files to the current date & resets
  558. X    archive bit.
  559. X
  560. X    TRUNCATE
  561. X    Usage    : truncate [n]
  562. X    Example : alias | sort | truncate
  563. X
  564. X    A filter that truncates the width of stdin to the specified number,
  565. X    trying to account for tab's and escape sequences. If the number is
  566. X    omitted, the current window width is used.
  567. X
  568. X    TYPE
  569. X    Equivalent to CAT.
  570. X
  571. X    UNALIAS
  572. X    Usage    : unalias name .. name
  573. X    Example    : unalias vt
  574. X
  575. X    Delete aliases..
  576. X
  577. X    UNIQ
  578. X    Usage    : uniq
  579. X
  580. X    This is a  filter that removes consecutive, duplicated lines in a
  581. X    file.  It is most useful on a sorted file.
  582. X
  583. X    UNSET
  584. X    Usage    : unset name .. name
  585. X    Example    : unset abc
  586. X
  587. X    Unset one or more variables.  Deletes them entirely.
  588. X
  589. X    USAGE
  590. X    Usage    : usage [command...command]
  591. X
  592. X    If called without arguments, usage gives you a short information
  593. X    on the special characters used. Otherwise, usage shows you the
  594. X    usage of the given commands. Calling a command with a '?' as
  595. X    the only argument will show its usage, too.
  596. X
  597. X    VERSION
  598. X    Usage    : version
  599. X
  600. X    Show current version name, & authors.
  601. X
  602. X    WAITFORPORT
  603. X    Usage    : waitforport portname [seconds]
  604. X
  605. X    Waits for a port to come up. Default time is 10 seconds.
  606. X
  607. X    WHEREIS
  608. X    Usage    : whereis [-r] filename [ device1...deviceN ]
  609. X
  610. X    If just a file name is given, cd searches all subdirectories of the
  611. X    current directory for that file. An asterisk '*' is appended to the
  612. X    file. Wild cards are allowed for the file (no asterisk will be
  613. X    appended then ), but no path names. If additional arguments are
  614. X    given, whereis searches only these paths, not the current directory.
  615. X    whereis -r look on all drives.
  616. X
  617. X    WINDOW
  618. X    Usage    : window [-q][-f][-b][-l][-s] [dimensions]
  619. X    Options    :
  620. X        -f    (front) Window to front
  621. X        -b    (back)  Window to back
  622. X        -l    (large) Window to maximum size
  623. X        -s    (small) Window to minimum size
  624. X        -a    (activate)
  625. X        -q    (query) Lists screens and windows open
  626. X
  627. X       Various  operations on CLI window.  If dimensions are specified,
  628. X    they must be in the form x y width height, with values separated by
  629. X    spaces.
  630. X       The  command  "window  -l" may be very useful on PAL machines to
  631. X    get  a  full  PAL  window  from  your login sequence, or if you use
  632. X    overscan WorkBench.
  633. X       Option  -q  gives,  for  each  Screen and Window currently open,
  634. X    title, left edge, top edge, width, height.
  635. X
  636. X
  637. XIX. SPECIAL SET VARIABLES
  638. X-------------------------
  639. X
  640. X    _bground
  641. X    True if the shell was started with a non-interactive input.
  642. X
  643. X    _clinumber
  644. X    Contains the number (1-20) of current CLI.
  645. X
  646. X    _cwd
  647. X    Holds a string representing the current directory we are in from
  648. X    root.  The SHELL can get confused as to its current directory if
  649. X    some external program changes the directory.  Use PWD to rebuild
  650. X    the _cwd variable in these cases.
  651. X
  652. X    _debug
  653. X    Debug mode... use it if you dare.  must be set to some value
  654. X
  655. X    _every
  656. X    Contains the name of a command that is output every time just before
  657. X    the prompt is printed. Do not use this to echo the prompt.
  658. X
  659. X    _except
  660. X    See EXCEPTION
  661. X
  662. X    _hilite
  663. X    Holds the font attributes used for highlighting. One letter for one
  664. X    attribute:
  665. X      b    for bold
  666. X      i    for italic
  667. X      u    for underlined
  668. X      r    for reverse
  669. X      c3   for foreground color 3
  670. X      c3,2 for foreground color 3 and background color 2
  671. X    Any combinations are allowed. _hilite defaults to "c7", in terminal
  672. X    mode to "r".
  673. X
  674. X    _history
  675. X    This variable is set to a numerical value, and specifies how far
  676. X    back your history should extend. Set it to 0 to disable history,
  677. X    for example if you test your programs for memory leaks. Defaults
  678. X    to 50.
  679. X
  680. X    _insert
  681. X    Sets the default for insert/overtype mode for command line
  682. X    editing. ^A toggles between, but after <RET> the default is
  683. X    set back as indicated by this variable. By default _insert is 1
  684. X    indicating insert mode on setting to zero will make overtype
  685. X    the default.
  686. X
  687. X    _kick2x
  688. X    True if dos.library V36 could be opened (which means that kickstart
  689. X    2.0 is around)
  690. X
  691. X    _lasterr
  692. X    Return code of last command executed.  This includes internal
  693. X    commands as well as external comands, so to use this variables
  694. X    you must check it IMMEDIATELY after the command in question.
  695. X
  696. X    _lcd
  697. X    Holds the name of the last directory. The builtin alias 'dswap'
  698. X    cd's to that directory. If called again, you're back where you
  699. X    were. I highly recommend to put this on a function key.
  700. X
  701. X    _man
  702. X    The name and path to you shell.doc file.
  703. X
  704. X    _maxerr
  705. X    The worst (highest) return value to date.  To use this, you usually
  706. X    set it to '0', then do some set of commands, then check it.
  707. X
  708. X    _minrows
  709. X    Gives the minimum number of rows a window must have to turn on quick
  710. X    scrolling. Defaults to 34.
  711. X
  712. X    _nobreak
  713. X    If set to some value, disables CTRL-C.
  714. X
  715. X    _noreq
  716. X    If set to some value , disables system requesters ("Please insert
  717. X    volume ...."). Turned on in vt200 mode.
  718. X
  719. X    _passed
  720. X    This variable contains the passed arguments when you SOURCE a file
  721. X    or execute a .sh file.  For instance:
  722. X
  723. X    test a b c d
  724. X
  725. X    -------- file test.sh ----------
  726. X    echo $_passed
  727. X    foreach i ( $_passed ) "echo YO $i"
  728. X    --------------------------------
  729. X
  730. X    _path
  731. X    Tells CShell where to look for executable files. The current direc-
  732. X    tory and the AmigaDOS path will be searched first. The trailing
  733. X    slash for directories is not necessary anymore.  The entire path
  734. X    will be searched first for the <command>, then for <command>.sh
  735. X    (automatic shell script sourcing). Example:
  736. X        set _path ram:c,ram:,sys:system,dh1:tools,df0:c
  737. X    (This path has the advantage that these directories need not even
  738. X     exist, that you can access devices (AmigaDOS path only knows 
  739. X     volumes under Kick 1.3) and that no disk seeks happen at startup)
  740. X
  741. X    _prompt
  742. X    This variable now can contain the following control characters:
  743. X     %c  for color change. This highlights your prompt. See _hilite
  744. X     %m  for memory. This shows your current memory in K
  745. X     %t  for time. This shows your current time in the format HH:MM:SS
  746. X     %d  for date. This shows the current date in the format DD-MMM-YY
  747. X     %p  for path. This inserts the current path
  748. X     %n  for number. This inserts the current process number
  749. X     %v  for version. This shows the version number of CShell
  750. X     %h  for history. This displays the current history number
  751. X     %f  for free store. This shows the free store on the current drive
  752. X     %r  for pRiority. Inserts the task priority of the current
  753. X    The default for prompt is now "%c%p> "
  754. X    The  if  command  will  set the prompt to a '_ ' if commands are
  755. X    disabled while waiting for a 'endif' or 'else' command (interactive
  756. X    mode only.
  757. X
  758. X    _qcd
  759. X    Holds the name of the file where the all directories on your hard 
  760. X    disk are stored. If not set, defaults to s:csh-qcd.
  761. X
  762. X    _rxpath
  763. X    The same as with _path, but this is where CShell looks for .rexx
  764. X    files. Defaults to REXX:
  765. X
  766. X    _scroll
  767. X    Holds the number of lines to be scrolled at once when quick scrolling
  768. X    is used. If unset or <=1, quick scrolling is off. Defaults to 3.
  769. X
  770. X    _terminal
  771. X    Indicated whether or not shell was started in terminal mode.
  772. X
  773. X    _titlebar
  774. X    The same control characters as for the _prompt can be used for
  775. X    _titlebar, too. The only difference is that %c is ignored. The
  776. X    titlebar is updated every time before the prompt appears.
  777. X
  778. X    _verbose
  779. X    Verbose mode (for source files).  display commands before they are
  780. X    executed.
  781. X
  782. X    _version
  783. X    Contains the version number of the shell, e.g. 490.
  784. X
  785. X
  786. XX.   FUNCTIONS
  787. X--------------
  788. X
  789. X    FUNCTIONS
  790. X    Functions are preceded by an @-sign and may not be abbreviated
  791. X    They must be preceded by a blank amd a blank must follow the opening
  792. X    and precede the closing brace. There must be no blank between the
  793. X    function name an the opening brace.
  794. X    (NOTE: Later versions of Shell might allow that functions need not
  795. X           be at the beginning of an argument, so quote any @-signs not
  796. X           used for functions)
  797. X
  798. X    Functions may be nested. The function names themselves are case
  799. X    sensitive, but the operations (like strcmp) aren't.
  800. X
  801. X    Functions can be used as commands. They will echo their return value
  802. X    to stdout. Note that they can't be abbreviated and that the function
  803. X    list is searched after the command list.
  804. X
  805. X    Note the difference between sets of words and strings. After
  806. X      set var hello world
  807. X    $var is a wordset, but after
  808. X      set var "hello world"
  809. X    var is one string. Although they look the same if echoed, they
  810. X    behave different, for example in 'foreach i ( var ) "echo hi'. The
  811. X     functions @split and @concat convert the two forms.
  812. X
  813. X
  814. X    @abbrev( str1 str2 [len] )
  815. X    true if the first <len> chars of str1 are an abbreviation of str2
  816. X    @abs( num )
  817. X    returns absolute value of <num>
  818. X    @age( file )
  819. X    the age of that file in days, 99999 if file not found
  820. X    @appsuff( name suffix )
  821. X    appends an suffix ( .ZOO ) to a string if it's not already there
  822. X    @availmem( [type] )
  823. X    returns free 'chip', 'fast' or otherwise total memory
  824. X    @basename( file )
  825. X    returns the file name of <file> without path
  826. X    @center( word len )
  827. X    returns a string of length <len> with <word> centered in it
  828. X    @checkport( portname )
  829. X    indicates if given port exists
  830. X    @clinum( procname )
  831. X    returns the number of the cli identified by a name or a number
  832. X    @complete( abbrev word ... word )
  833. X    returns the first word <abbrev> is an abbreviation of
  834. X    @concat( word word ... word )
  835. X    concats all words in one blank separated string, see @split
  836. X    @confirm( title item ... item )
  837. X    asks for confirmation of every item and returns the confirmed ones
  838. X    @dectohex( number )
  839. X    returns a string representing <number> in hex
  840. X    @delword( word word ... word n )
  841. X    returns a string with the n-th word deleted.
  842. X    @delwords( word word ... word n m )
  843. X    deletes the next m words from the n-th.
  844. X    @dirs( name name name name )
  845. X    returns the directories among the given file names, see @files
  846. X    @drive( path )
  847. X    outputs the drive ( device ) name associated to <path>
  848. X    @drives( )
  849. X    outputs all available drives
  850. X    @exists( file )
  851. X    tells whether a file exists or not
  852. X    @fileblks( file file ... file )
  853. X    returns the # of blocks needed for the files, incl. dir blocks
  854. X    @filelen( file file ... file )
  855. X    count the total number of bytes of the given files
  856. X    @fileprot( file )
  857. X    returns a string like ---arwed
  858. X    @filereq( title path&pattern filename )
  859. X    brings up the arp file requester and returns the selected file name
  860. X    @files( file file ... file )
  861. X    gives you the files among those names, no directories. see @dirs
  862. X    @freebytes( path )
  863. X    the number of free bytes on the given path
  864. X    @freeblks( path )
  865. X    the number of free blocks on the given path
  866. X    @freestore( path )
  867. X    the amount of free store on that path, given in K, M and G
  868. X    @getenv( varname )
  869. X    returns the value of the named env: variable
  870. X    @getclass( file )
  871. X    returns the class (type) of the file. See chapter XIV
  872. X    @howmany
  873. X    indicates the # of shells running
  874. X    @index( string pattern )
  875. X    returns the index of pattern in string (starting at 1), 0 if not found
  876. X    @info( path )
  877. X    the corresponding line from the 'info' command, each entry a word
  878. X    @intersect( word1 word2 word3 , word4 word5 word6 )
  879. X    returns all words which are in both lists. see @union, @member
  880. X    @lookfor( file paths )
  881. X    looks for a file in the current directory and the given paths
  882. X    @lower
  883. X    lowercases its arguments. see @upper
  884. X    @match( word ... word "pattern" )
  885. X    returns the words in the list that match the arp-pattern
  886. X    @max( num num ... num )
  887. X    computes the maximum of all given numbers
  888. X    @megs( number )
  889. X    expresses a number in K, M and G (-bytes), rounded correctly
  890. X    @member( word1 word word ... word )
  891. X    tells you if word1 is among the remaining words
  892. X    @min( num num ... num )
  893. X    computes the minimum of all given numbers
  894. X    @nameext( filename )
  895. X    returns all after the last dot of <filename>.
  896. X    @nameroot( filename )
  897. X    returns all before the LAST dot of <filename>.
  898. X    @pathname( path )
  899. X    strips the base name from a path
  900. X    @pickargs( arg ... arg )
  901. X    picks of its arguments those which don't start with a '-'
  902. X    @pickopts( arg ... arg )
  903. X    picks of its arguments those which start witch a '-'
  904. X    @rpn( expression )
  905. X    computes the rpn expression. See rpn command
  906. X    @sortargs( name ... name )
  907. X    sorts its arguments alphabetically
  908. X    @split( string )
  909. X    makes each blank separated part of @string a word, see @concat
  910. X    @strcmp( name name )
  911. X    returns -1, 0 or 1 depending of alphabetical comparison
  912. X    @strhead( breakchar string )
  913. X    see strhead command
  914. X    @strleft( string number )
  915. X    see strleft command
  916. X    @strmid( string n1 n2 )
  917. X    see strmid command
  918. X    @strright( string n )
  919. X    see strright command
  920. X    @strtail( breakchar string )
  921. X    see strtail command
  922. X    @subwords( word ... word n m )
  923. X    returns the next m words word of the given list starting from n
  924. X    @tackon( path file )
  925. X    see tackon command
  926. X    @unique( word ... word )
  927. X    sorts the arguments and makes each of them unique
  928. X    @union( name ... name , name ... name )
  929. X    returns all names that are in either list. See @intersect, @member
  930. X    @upper( word ... word )
  931. X    upper cases the given words. see @lower
  932. X    @volume( path )
  933. X    returns the volume name in that path or "" if no disk present
  934. X    @winheight( )
  935. X    outputs the height of your window in pixels
  936. X    @winleft( )
  937. X    returns the left edge of your window
  938. X    @wintop( )
  939. X    returns the top edge of your window
  940. X    @winwidth( )
  941. X    outputs the width of your window in pixels
  942. X    @without( name ... name , name ... name )
  943. X    returns all names of list 1 that are not in list 2
  944. X    @word( name ... name n )
  945. X    picks the n-th word from the list.
  946. X    @words( name ... name )
  947. X    returns the number of words in the list.
  948. X
  949. X
  950. XXI. MISCELLANEOUS
  951. X-----------------
  952. X
  953. X    QUICK SCROLLING
  954. X    CShell has now allows to do quick scrolling in large windows.
  955. X    Quick scrolling means that whenever the cursor reaches the bottom
  956. X    of the window, the text jumps up 3 or more lines at once. However,
  957. X    only the following commands support this (yet):
  958. X    - dir, cat, htype, strings, search, truncate, tee
  959. X    You can choose the number of lines to scroll at once by setting
  960. X    the variable _scroll. Unsetting it or setting it to a value <=1
  961. X    completely disables quick scrolling.
  962. X    You can also choose the number lines a window must at least have
  963. X    to turn on the quick scrolling by setting the _minrows variable.
  964. X    (Defaults to 34). Quick scrolling is automatically disabled when
  965. X    the command is redirected. By piping any command to cat, you can
  966. X    force it to quick scroll. Example:  List | cat
  967. X
  968. X
  969. X    CLOSING GADGET
  970. X    CShell now can be terminated using the closing gadget in the
  971. X    AmigaDOS 2.0 shell window. Don't execute c:ENDCLI while using
  972. X    the shell. This can cause problems with external commands. The
  973. X    closing button provides a 'quit' command. You can define
  974. X      alias quit "Endcli;\quit
  975. X    to assert that the CLI window closes when you click the button.
  976. X
  977. X
  978. X    EXCEPTION PROCESSING
  979. X    If  no  _except variable exists, any command which fails causes the
  980. X    rest of the line to abort as if an ABORTLINE had been executed.  If
  981. X    the _except variable exists, it is of the form:
  982. X
  983. X    "nnn;commands..."
  984. X
  985. X    where  nnn  is  some  value  representing  the  minimum return code
  986. X    required  to  cause  an  error.   Whenever a command returns a code
  987. X    which  is  larger  or  equal  to  nnn,  the commands in _except are
  988. X    executed  before  anything.   WHEN _except EXISTS, THE COMMAND LINE
  989. X    DOES  NOT  ABORT AUTOMATICALLY.  Thus, if you want the current line
  990. X    being executed to be aborted, the last command in _except should be
  991. X    an "abortline".
  992. X
  993. X    Exception  handling  is  disabled  while  in the exception handling
  994. X    routine (thus you can't get into any infinite loops this way).
  995. X
  996. X    Thus if _except = ";", return codes are completely ignored.
  997. X
  998. X    Example:
  999. X
  1000. X    set _except "20;abortline"
  1001. X
  1002. X    KNOWN BUGS
  1003. X    - under 2.0, doing a 'cat' with no args will cause a character to
  1004. X      appear at the right border of the window. still figuring out...
  1005. X    - does not restore old menu strips
  1006. X    - guaranteed to crash in extreme low mem situations
  1007. X    - command line editing doesn't quite work on a (physical) vt100
  1008. X    - under kick 2.00, fast repetition of ^W crashed. OK under 2.02
  1009. X    - 'set x a b;echo hello$x' still outputs only 'a b'
  1010. X
  1011. X    INCOMPATIBILITIES
  1012. X
  1013. X    Old shell scripts *should* continue to run under Shell 5.00 and
  1014. X    above. There are, however, a few minor incompatibilities:
  1015. X
  1016. X    - 'copy -f' was introduced in 4.02 and meaned "don't set destination
  1017. X      protection bits". It has changed to 'freshen'. Protection bits are
  1018. X      now 'copy -p'.
  1019. X    - 0 is now 'false'. Example:
  1020. X        if 0;echo hi;else;echo ho;endif        -->  ho
  1021. X    - ~ at the beginning of a file name must now be quoted
  1022. X    - @ is the beginning of a function should be quotet. No harm is done
  1023. X      (yet) if function is found:
  1024. X        echo @foobar                           --> @foobar
  1025. X    - the builtin alias 'kr' is gone, because killing ram:* causes
  1026. X      problems under kickstart 2.0 (ENV: is gone). If you're running
  1027. X      1.3, you can put it in your .login.
  1028. X    - cat no more appends a CR to the file if stdin is used as input and
  1029. X      stdin is not CR terminated
  1030. X    - several abbreviations now call different commands: Typing 'g' now
  1031. X      invokes 'getenv' instead of 'goto'. There is a script 'compat.sh'
  1032. END_OF_FILE
  1033. if test 33033 -ne `wc -c <'shell.doc.ab'`; then
  1034.     echo shar: \"'shell.doc.ab'\" unpacked with wrong size!
  1035. fi
  1036. # end of 'shell.doc.ab'
  1037. fi
  1038. echo shar: End of archive 5 \(of 6\).
  1039. cp /dev/null ark5isdone
  1040. MISSING=""
  1041. for I in 1 2 3 4 5 6 ; do
  1042.     if test ! -f ark${I}isdone ; then
  1043.     MISSING="${MISSING} ${I}"
  1044.     fi
  1045. done
  1046. if test "${MISSING}" = "" ; then
  1047.     echo You have unpacked all 6 archives.
  1048.     rm -f ark[1-9]isdone
  1049. else
  1050.     echo You still need to unpack the following archives:
  1051.     echo "        " ${MISSING}
  1052. fi
  1053. ##  End of shell archive.
  1054. exit 0
  1055. -- 
  1056. Mail submissions (sources or binaries) to <amiga@uunet.uu.net>.
  1057. Mail comments to the moderator at <amiga-request@uunet.uu.net>.
  1058. Post requests for sources, and general discussion to comp.sys.amiga.misc.
  1059.